<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="/static/css/index.css">
</head>

<body>



    <h1>修改密码</h1>

    <a href="/static/html/login.html">登陆</a>

    <a href="/static/html/reg.html">注册</a>

    <script>


        const token = localStorage.getItem('token');


        const xhr = new XMLHttpRequest();
        xhr.open('post', '/api/users/rpwd', true);
        xhr.setRequestHeader('content-type', 'application/x-www-form-urlencoded');
        // 携带token   通过请求头携带
        xhr.setRequestHeader('authorization', token);

        xhr.send('user=qq&pass=666&newPwd=999');
        xhr.onreadystatechange = function () {
            if (xhr.readyState === 4 && xhr.status === 200) {
                console.log(xhr.responseText);


                // 重新登陆

            }
        }

    </script>

</body>

</html>